# Makefile for JamesM's kernel tutorials.
# The C and C++ rules are already setup by default.
# The only one that needs changing is the assembler 
# rule, as we use nasm instead of GNU as.

OBJS=boot.o main.o gdt.o isr.o interrupt.o descriptor_tables.o common.o scrn.o kb.o\
	 timer.o kheap.o page.o

CFLAGS=-Wall -nostdlib -nostdinc -fno-builtin -fno-stack-protector
INC= -I./
LDFLAGS=-Tlink.ld
ASFLAGS=-felf

all: $(OBJS) link

install: all
	del a:\kernel
	copy  kernel a:\


clean:
	del *.o 
	del kernel

link:
	ld-elf $(LDFLAGS) -o kernel $(OBJS)

.s.o:
	nasm $(ASFLAGS) $<

.c.o:
	gcc $(CFLAGS) $(INC) -c $<
